package ch.zbw.sysventory.agent.scanner.impl;

import java.util.Date;

import ch.zbw.sysventory.agent.scanner.ComputerScanner;
import ch.zbw.sysventory.agent.scanner.WMIHelper;
import ch.zbw.sysventory.transport.model.ScanResult;

public class ComputerScannerImpl implements ComputerScanner {

	@Override
	public ScanResult scanComputer() {
		WMIHelper wMIHelper = new WMIHelper();
		NetworkAdapterScanner networkAdapterScanner = new NetworkAdapterScanner();
		SoftwareScanner softwareScanner = new SoftwareScanner();
		PrinterScanner printerScanner = new PrinterScanner();
		ScanResult scanResult = new ScanResult();

		scanResult.setTimeStamp(new Date());
		scanResult.setComputerName(wMIHelper.getComputerName());
		scanResult.setComputerType(wMIHelper.getComputerType());
		scanResult.setCpu(wMIHelper.getCPU());
		scanResult.setOperatingSystem(wMIHelper.getOperatingSystem());
		scanResult.setRam(wMIHelper.getRAM());
		scanResult.setSid(wMIHelper.getSID());

		scanResult.setNetworkAdapters(networkAdapterScanner.getNetworkAdapters());
		scanResult.setSoftware(softwareScanner.getSoftwareList());
		scanResult.setPrinters(printerScanner.getPrinters());

		return scanResult;
	}

}
